/*
 * printer.h
 *
 *  Created on: Mar 13, 2012
 *      Author: our_beastie
 */

#ifndef PRINTER_H_
#define PRINTER_H_


#include "queue.h"
#include <stdio.h>

#define SEMAPHORE_LOCK 0
#define MAX_REQUESTS 100

struct CPUStr;
typedef struct CPUStr* CPU_PRNTR;

enum InterruptRequestType {
    TIMER_INT,
    KEYBOARD_INT,
    IO_INT,
    PROD_INT,
    CONS_INT,
    NULL_INT
} InterruptRequestType;

enum SystemCallRequestType {
    IO_CALL,
    KEYBOARD_CALL,
    PRODUCER_CALL,
    CONSUMER_CALL,
    NULL_CALL
} SystemCallRequestType;


typedef struct {
	enum InterruptRequestType irt;
	enum SystemCallRequestType scrt;
	int pid;
	int pstate;
} PrinterRequestStr;

typedef PrinterRequestStr* PrinterRequest;

PrinterRequest newPrinterRequest(enum InterruptRequestType irt,
		enum SystemCallRequestType scrt, int pid, int pstate);
void destroyPrinterRequest(PrinterRequest pr);

typedef struct {
	CPU_PRNTR cpu;

} PrinterStr;

typedef PrinterStr* Printer;

Printer newPrinter(CPU_PRNTR cpu);
void print(Printer p, PrinterRequest pr);



#endif /* PRINTER_H_ */
